package cn.stylefeng.guns.sys.modular.system.service;

import cn.stylefeng.guns.sys.modular.system.entity.BtyBank;
import cn.stylefeng.guns.sys.modular.system.mapper.BtyBankMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

@Service
public class BtyBankService {

    @Autowired
    private BtyBankMapper btyBankMapper;

    /**
     * 获取档案管理列表
     *
     * @author fengshuonan
     * @Date 2018/12/23 6:05 PM
     */
    public void insert() {
        Calendar ca = Calendar.getInstance();//得到一个Calendar的实例
        ca.setTime(new Date());
        ca.add(Calendar.DATE, -10);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");//小写的mm表示的是分钟
        String substring = sdf.format(ca.getTime());
        List<BtyBank> s = btyBankMapper.selectMoney(substring);
        if (s.size() > 0) {
            for (BtyBank bb : s) {
                btyBankMapper.insert(bb.getId(), bb.getMoney());
            }
        }
    }
}